﻿CREATE TABLE [dbo].[tblSequenceOrderStep]
(
    [SequenceOrderStepID]     INT      IDENTITY (1, 1) NOT NULL primary key,
    [SequenceStepID]         INT      NOT NULL,
    [SequenceOrderID]    INT      NULL,
    [Delay]              SMALLINT NOT NULL,
    [RecurrenceTerm]     SMALLINT NOT NULL,
    [RecurrenceCount]    SMALLINT NOT NULL,
	[CurrentCount]		int null,
	[NextTriggerDate]	smalldatetime null,
	[LastOrderID]	int	null,
	[Shipping]		money null
);
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', 
	@value = N'The number of days to delay from the previous step', 
	
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblSequenceOrderStep',
	@level2type = N'COLUMN', @level2name = N'Delay';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', 
	@value = N'The number of days between recurrences of this step', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblSequenceOrderStep',
	@level2type = N'COLUMN', @level2name = N'RecurrenceTerm';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', 
	@value = N'The number of times the step recurres before continuing to the next step.  Set to 0 if this step is to recur indefinately.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblSequenceOrderStep',
	@level2type = N'COLUMN', @level2name = N'RecurrenceCount';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', 
	@value = N'The recurrence cycle that this step is currently in.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblSequenceOrderStep',
	@level2type = N'COLUMN', @level2name = N'CurrentCount';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', 
	@value = N'The next date that this SequenceOrderStep will trigger a new order.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblSequenceOrderStep',
	@level2type = N'COLUMN', @level2name = N'NextTriggerDate';

